package org.bw.bookstore.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 *@program: wisdom_bookstore
 *@description: 公共实体类
 *@Author: 孙冬雪
 *@Date: 2020-10-22 09:50
 */
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@MappedSuperclass
public class BaseEntity implements Serializable {

    /**
     * id: 主键
     **/
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(hidden = true)
    private Integer id;

    /**
     * code: 唯一标识
     **/
    @ApiModelProperty(hidden = true)
    private String code;

    /**
     * updateTime: 更新时间
     **/
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    @ApiModelProperty(hidden = true)
    private Date updateTime;

    /**
     * createTime: 创建时间
     **/
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    @ApiModelProperty(hidden = true)
    private Date createTime;

    /**
     * deleted: 逻辑删除（0：未删除，1：已删除）
     **/
    @ApiModelProperty(hidden = true)
    private Integer deleted;
}
